package com.github.catvod.spider.merge;

import com.github.catvod.spider.merge.iC;
import javax.annotation.Nullable;

/* loaded from: classes.dex */
public class zt {

    private static class Tw implements aC {
        private final Dv V0;
        private final Lm h;
        private final ms j;

        Tw(Lm lm, Dv dv, ms msVar) {
            this.h = lm;
            this.V0 = dv;
            this.j = msVar;
        }

        @Override // com.github.catvod.spider.merge.aC
        public void V0(fa faVar, int i) {
            if (faVar instanceof Lm) {
                Lm lm = (Lm) faVar;
                if (this.j.h(this.h, lm)) {
                    this.V0.add(lm);
                }
            }
        }

        @Override // com.github.catvod.spider.merge.aC
        public void h(fa faVar, int i) {
        }
    }

    private static class yh implements iC {

        @Nullable
        private Lm V0 = null;
        private final Lm h;
        private final ms j;

        yh(Lm lm, ms msVar) {
            this.h = lm;
            this.j = msVar;
        }

        @Override // com.github.catvod.spider.merge.iC
        public iC.Tw V0(fa faVar, int i) {
            if (faVar instanceof Lm) {
                Lm lm = (Lm) faVar;
                if (this.j.h(this.h, lm)) {
                    this.V0 = lm;
                    return iC.Tw.STOP;
                }
            }
            return iC.Tw.CONTINUE;
        }

        @Override // com.github.catvod.spider.merge.iC
        public iC.Tw h(fa faVar, int i) {
            return iC.Tw.CONTINUE;
        }
    }

    @Nullable
    public static Lm V0(ms msVar, Lm lm) {
        yh yhVar = new yh(lm, msVar);
        bY.h(yhVar, lm);
        return yhVar.V0;
    }

    public static Dv h(ms msVar, Lm lm) {
        Dv dv = new Dv();
        bY.V0(new Tw(lm, dv, msVar), lm);
        return dv;
    }
}
